package com.usian.fastdfs.task.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * 分布式调度
 */
@Component
public class HelloJob {

//获取端口号
    @Value("${server.port}")
    private String appPort;

    @XxlJob("hellojob")//`这个一定要与调度中心新建任务的JobHandler的值保持一致
    //ReturnT<String>:为了返回给用户提示信息
    public ReturnT<String> hello(String param) throws Exception {
        System.out.println("helloJob："+ LocalDateTime.now()+",端口号"+appPort);
        return ReturnT.SUCCESS;
    }

}
